<?php
require_once ('Smarty.class.php');

class Controller
{
	private $_smarty;
	
	public function __construct()
	{

		$this->_smarty = new Smarty();
		
		//smarty configureren
		$this->_smarty->template_dir = DOCUMENT_ROOT . 'views';
		$this->_smarty->config_dir = SMARTY_ROOT . 'configs';
		$this->_smarty->compile_dir = SMARTY_ROOT . 'templates_c';
		
		$this->setheader();
	}

	public function assign($p_sKey,$p_cItem)
	{
		$this->_smarty->assign($p_sKey,$p_cItem);
	}
	
	public function render($p_sName)
	{
		$this->_smarty->display($p_sName);
	}
	
	public function setheader()
	{
		$menuitems = array();
		$menuitems[] = '<a href="' . DOMAIN_URL . '/index/index">home</a>';
		$menuitems[] = '<a href="' . DOMAIN_URL . '/login/index">login</a>';
		$menuitems[] = '<a href="' . DOMAIN_URL . '/feeds/index">rss</a>';
		
		print $_SESSION['user'];
		
		//if(isset($_SESSION['user']))
		//{
			//if($_SESSION['user']->getRole() === admin)
			//{
				$menuitems[] = '<a href="' . DOMAIN_URL . '/admin/index">Adminstration Page</a>';
			//}
				
			//$menuitems[] = '<a href="' . DOMAIN_URL . '/login/logout">Uitloggen</a>';
		//}
		
		$this->assign('menuitems',$menuitems);
	}
}
?>